//
//  RankViewController.m
//  ksjv2
//
//  Created by mac on 14/12/18.
//  Copyright (c) 2014年 CnbizMedia. All rights reserved.
//
//---------------------------------------------------------
//                    *              *
//                  *      我的等级     *
//                    *              *
//---------------------------------------------------------
#import "RankViewController.h"
#import "Util.h"

#define animateDate 0.5

@interface RankViewController (){
    
}

@end

@implementation RankViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=UIColorFromRGB(0xf5f5f5);
    self.title=@"我的等级";
    NSDictionary*dic=[UserDefaults objectForKey:@"user"] ;
    UILabel*label=(UILabel*)[self.view viewWithTag:222];
    UILabel*point=[[UILabel alloc]initWithFrame:CGRectMake(0, label.frame.origin.y, self.view.frame.size.width-20, label.frame.size.height)];
    point.textAlignment = NSTextAlignmentRight;
    point.text=dic[@"point"];
    point.textColor=[UIColor blackColor];
    [self.view addSubview:point];
    
    UILabel*label2=(UILabel*)[self.view viewWithTag:111];
    UILabel*vip=[[UILabel alloc]initWithFrame:CGRectMake(0, label2.frame.origin.y, self.view.frame.size.width-20, label2.frame.size.height)];
    vip.text=[NSString stringWithFormat:@"LV %@",dic[@"vip"]];
    vip.textAlignment = NSTextAlignmentRight;
    vip.textColor=[UIColor blackColor];
    [self.view addSubview:vip];
    
    UILabel*label3=(UILabel*)[self.view viewWithTag:333];
    UILabel*userid=[[UILabel alloc]initWithFrame:CGRectMake(0, label3.frame.origin.y, self.view.frame.size.width-20, label3.frame.size.height)];
    userid.text=[NSString stringWithFormat:@"%@",dic[@"userid"]];
    userid.textAlignment = NSTextAlignmentRight;
    userid.textColor=[UIColor blackColor];
    [self.view addSubview:userid];
//    label3.text=[NSString stringWithFormat:@"    用户ID:%@",dic[@"userid"]];
    
    
    UIButton *buttonf=[UIButton buttonWithType:UIButtonTypeCustom];
    [buttonf setFrame:CGRectMake(0, 0, 22, 22)];
    [buttonf addTarget:self action:@selector(popOfDismss) forControlEvents:UIControlEventTouchUpInside];
    [buttonf setImage:[UIImage imageNamed:@"dismiss"] forState:UIControlStateNormal];
    
    NSString *newOldYear = [UserDefaults objectForKey:@"NewYear" ];
    if ([newOldYear isEqualToString:@"NewYear"]) {
        //状态栏的文字颜色换成白色
        //        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
        
        //            [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
        [buttonf setImage:[UIImage imageNamed:@"dismissGray"] forState:UIControlStateNormal];
        
    }
 
    UIBarButtonItem*leftBarItem = [[UIBarButtonItem alloc]initWithCustomView:buttonf];
    self.navigationItem.leftBarButtonItem=leftBarItem;
}

-(void)popOfDismss{
    if ([[self.navigationController viewControllers] count]>=2) {
        [self.navigationController popViewControllerAnimated:YES];
        
    }else{
        
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
